package org.ljy.lotterysystem.service.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 活动状态枚举
 */

@Getter
@AllArgsConstructor
public enum ActivityStatusEnum {

    RUNNING(1,"活动进行中"),
    COMPLETED(2,"活动已完成");

    private final Integer code;
    private final String message;

    /**
     * 字符串转成响应的枚举类型
     */
    public static ActivityStatusEnum forName(String name) {
        for(ActivityStatusEnum activityStatusEnum : ActivityStatusEnum.values()) {
            if(activityStatusEnum.name().equalsIgnoreCase(name)) {
                return activityStatusEnum;
            }
        }
        return null;
    }

}
